import React, { Component } from 'react';
import ReactDom from 'react-dom';
import axios from 'axios';
import util from "@/common/util"
import layer from '@/common/layer'
import jquerydate from '@/common/jquerydate'
import Sel1View from '@/components/sel1'
import RadioPicker2 from '@/components/RadioPicker2'
import RadioPicker1 from '@/components/RadioPicker1'
import Picker from '@/components/picker'
import jquery from 'jquery';

class Declarv2 extends Component {
    constructor(props) {
        super()
        this.loantype0 = [
            { // professinfo  个人信息
                key: 'name',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "姓名不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'tellphone',
                func(str) {
                    if (str.length !== 11) {
                        layer.open({content: "手机号码格式错误",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'operatecopname',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "工作单位名称不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
              {
                key: 'socialinstime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "社保缴存期限(月)不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'jobtime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "当前单位工作期限(月)不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'monthsalary',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "打卡工资（月度）不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'loanintend',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "贷款用途不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            { 
                key: 'payment',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "还款来源不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'loannum',
                func(str) {
                    if (str.length === 0) {
                        layer.open({ content: "借款金额(万元)不能为空",btn: "好的" })
                        return false
                    }
                    return true
                }
            },
            { 
                key: 'loantime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "借款期限(月)不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
        ]

         this.loantype1 = [
            { // professinfo  个人信息
                key: 'name',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "姓名不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'tellphone',
                func(str) {
                    if (str.length !== 11) {
                        layer.open({content: "手机号码格式错误",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'operatecopname',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "工作单位名称不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
              {
                key: 'socialinstime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "社保缴存期限(月)不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'jobtime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "当前单位工作期限(月)不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'monthsalary',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "打卡工资（月度）不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'loanintend',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "贷款用途不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            { 
                key: 'payment',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "还款来源不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'loannum',
                func(str) {
                    if (str.length === 0) {
                        layer.open({ content: "借款金额(万元)不能为空",btn: "好的" })
                        return false
                    }
                    return true
                }
            },
            { 
                key: 'loantime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "借款期限(月)不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             {// car
                key: 'carnum',
                func(str) {
                    if (str.length === 0) {
                        layer.open({ content: "车牌号不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'caryear',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "上牌年限(月)不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
        ]

         this.loantype2 = [
            { // professinfo  个人信息
                key: 'name',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "姓名不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'tellphone',
                func(str) {
                    if (str.length !== 11) {
                        layer.open({content: "手机号码格式错误",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'operatecopname',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "工作单位名称不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
              {
                key: 'socialinstime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "社保缴存期限(月)不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'jobtime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "当前单位工作期限(月)不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'monthsalary',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "打卡工资（月度）不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'loanintend',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "贷款用途不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            { 
                key: 'payment',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "还款来源不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'loannum',
                func(str) {
                    if (str.length === 0) {
                        layer.open({ content: "借款金额(万元)不能为空",btn: "好的" })
                        return false
                    }
                    return true
                }
            },
            { 
                key: 'loantime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "借款期限(月)不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
              //job
            { key: 'housefund',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "双边汇款额(元)不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            { key: 'fundarea',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "公积金缴存地不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
        ]

         this.loantype3 = [
            { // professinfo  个人信息
                key: 'name',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "姓名不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'tellphone',
                func(str) {
                    if (str.length !== 11) {
                        layer.open({content: "手机号码格式错误",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'loanintend',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "贷款用途不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            { 
                key: 'payment',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "还款来源不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'loannum',
                func(str) {
                    if (str.length === 0) {
                        layer.open({ content: "借款金额(万元)不能为空",btn: "好的" })
                        return false
                    }
                    return true
                }
            },
            { 
                key: 'loantime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "借款期限(月)不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
              { //house
                key: 'houseaddress',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "房屋地址不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
           {
                key: 'minhouseworth',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "房屋最小价值不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             {
                key: 'maxhouseworth',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "房屋最大价值不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'housearea',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "房屋面积不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
        ]

         this.loantype4 = [
            { // professinfo  个人信息
                key: 'name',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "姓名不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'tellphone',
                func(str) {
                    if (str.length !== 11) {
                        layer.open({content: "手机号码格式错误",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'operatecopname',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "工作单位名称不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
              {
                key: 'socialinstime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "社保缴存期限(月)不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {
                key: 'jobtime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "当前单位工作期限(月)不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'monthsalary',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "打卡工资（月度）不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'loanintend',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "贷款用途不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            { 
                key: 'payment',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "还款来源不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             { 
                key: 'loannum',
                func(str) {
                    if (str.length === 0) {
                        layer.open({ content: "借款金额(万元)不能为空",btn: "好的" })
                        return false
                    }
                    return true
                }
            },
            { 
                key: 'loantime',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "借款期限(月)不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             // insurance  保单信息
            {
                key: 'insurancenperson',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "投保人姓名不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
             {
                key: 'yearfeelimit',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "年度汇缴额（元）不能为空",btn: "好的"})
                        return false
                    }
                    return true
                }
            },
            {  
                key: 'insurancelimit',
                func(str) {
                    if (str.length === 0) {
                        layer.open({content: "汇缴期限（月）不能为空", btn: "好的"})
                        return false
                    }
                    return true
                }
            },
        ]

        this.state = {
            loantypetit:'请选择贷款类型',
            loantypeselGroups:[{ value: 0, label: '房贷' },{ value: 1, label: '车贷' },{ value: 2, label: '信用贷' },{ value: 3, label: '保单贷' },{ value: 4, label: '公积金贷' }],
            loantypesel: -1,
            loantypeselLabel: '请选择',
            loantypeselShow: false,

            protit:'请选择贷款产品',
            professionalGroups: [],
            professional: -1,
            professionalLabel: '请选择',
            professionalShow: false,
            // ddtime:'',
            // professinfo  个人信息
            name: '',
            tellphone: '',
            merryTypeGroups: [{ value: 0, label: '已婚' }, { value: 1, label: '未婚' }, { value: 2, label: '离异' }],
            merryType: 0,
            operatecopname: '',
            jobStateGroups: [{ value: 0, label: '法人' }, { value: 1, label: '股东' }, { value: 2, label: '雇员' }],
            jobState: 0,
            socialinstime: '',
            jobtime:'',
            monthsalary: '',
            loanintend:'',
            payment:'',
            loannum:'',
            loantime:'',
            // identityimg:'',
            // creditimg:'',
            // car
            carnum: '',
            caryear: '',
            carimg:'',
            //公积金信息
            housefund: '',
            fundarea:'',
            fundimg:'',
            // house
            houseaddress: '',
            housenatureTypeGroups: [{ value: 0, label: '全款' }, { value: 1, label: '按揭' }],
            housenatureType: 0,
            minhouseworth: '',
            maxhouseworth: '',
            housearea: '',
            houseTypeGroups: [{ value: 0, label: '商品房' }, { value: 1, label: '房改房' }, { value: 2, label: '经适房' }, { value: 3, label: '动迁房' }, { value: 4, label: '其他房产类' }],
            houseType: 0,
            houseTypeother: '',
            mortgageTypeGroups: [{ value: 0, label: '一押' }, { value: 1, label: '二押' }],
            mortgageType: 0,
            houseMortgageMoney: '',
            houseMoney:'',
            houseimg:'',
            // insurance 保单信息
            insurancelimit: '',
            insurancenperson: '',
            yearfeelimit: '',
        }
    }

    componentDidMount() {
        //
        jquery.date('#date3');

        //房贷添加“无”选择样式
        jquery(".b").on('click',function(){
            jquery(this).find(".i").toggleClass("iactive")
            var item=jquery(this).attr("id")
            if( jquery(this).find(".i").hasClass('iactive')){
                localStorage.setItem(item,1)//存入storage，为1 选中，为0 未选中
            }else{
                localStorage.setItem(item,0)
            } 
        })

        //将存入storage的'no+"item"'取出,判断为1时，添加选中样式
        var item=["nosocialinstime","nojobtime","nomonthsalary"]
        for(var j in item){
            if(localStorage.getItem(item[j])==1){
                jquery("#"+item[j]).find(".i").addClass("iactive")
            }
        }
        
       
        //将input name val 存入storage
        var arr = []
        jquery("input").on("change", function () {
            alert("change:  "+111)
            var obj = {}
            var inputname = jquery(this).attr("name")
            var inputval = jquery(this).val()
            obj[inputname] = inputval
            arr.push(obj)
            var data = localStorage.getItem("inputdata"+that.state.loantypesel)//判断local里有没有inputdata
            if (!data || data === 'null') {//没有
                localStorage.setItem("inputdata"+that.state.loantypesel, JSON.stringify(arr))
            } else {//已存在
                var data1 = JSON.parse(data)
                var array = data1.concat(arr)
                localStorage.setItem("inputdata"+that.state.loantypesel, JSON.stringify(array))
            }
        })

        //uploadbtn 上传身份证
        jquery('input.identity').on('change', function () {
            var fileInput = jquery(this)
            util.fileUpload(fileInput[0].files[0], function (res) {
                var thisupload=fileInput.parents(".iduploadimg")
                var thisparent= fileInput.parents('.iduploadbox')
                thisupload.find(".idshowimg").attr("src",res.data).show()
                thisupload.find(".idcloseimg").show()
                //1.上传图片后判断是不是小于两个uploadimg 是：再添加一个uploadimg  否：不操作
                if(thisparent.find('.iduploadimg').length< 2){
                   var clone= jquery(".iduploadimg").clone(true)
                   clone.find('.idshowimg').attr({"src":'','id':''}).hide()
                   clone.find('.idcloseimg').hide()
                   thisparent.append(clone)
                }
            })
        })

        //图片预览
        var img=['id','cr','car','fund']
        for(var i in img){
            jquery("."+img[i]+"showimg").on('click',function(){
                var src=jquery(this).attr("src")
                if(src==''){}else{
                    jquery(".previewbox").find(".previewimg").attr("src",src)
                    jquery(".previewbox").show()
                }
            })
        }

         jquery(".previewbox").on('click',function(){
             jquery(this).hide()
         })

        //uploadbtn 上传征信报告
        // var creditpic=[]
        // var that=this
        jquery('input.credit').on('change', function () {
            var fileInput = jquery(this)
            util.fileUpload(fileInput[0].files[0], function (res) {
                var thisupload=fileInput.parents(".cruploadimg")
                var thisparent= fileInput.parents('.cruploadbox')
                thisupload.find(".crshowimg").attr("src",res.data).show()
                thisupload.find(".crcloseimg").show()
                //1.上传图片后判断是不是小于两个uploadimg 是：再添加一个uploadimg  否：不操作
                if(thisparent.find('.cruploadimg').length< 5){
                    var clone
                    jquery(".cruploadimg").each(function(){
                      clone=jquery(this).clone(true)
                    })
                   clone.find('.crshowimg').attr({"src":'','id':''}).hide()
                   clone.find('.crcloseimg').hide()
                   thisparent.append(clone)
                }
                // creditpic.push(res.data)
            })
        //     that.setState({creditimg:creditpic.join(";")})
        //  console.log("creditpic:  "+creditpic)
        //  console.log("creditimg:  "+that.state.creditimg)
        })
        


         //uploadbtn 上传行驶证
         var that=this
        jquery('input#carupinput').on('change', function () {
            var fileInput = jquery(this)
            util.fileUpload(fileInput[0].files[0], function (res) {
                var thisupload=fileInput.parents(".caruploadimg")
                thisupload.find(".carshowimg").attr("src",res.data).show()
                thisupload.find(".carcloseimg").show()
                that.setState({carimg:res.data})
            })
            console.log(fileInput)
        })

         //删除行驶证图片
           jquery(".carcloseimg").on('click',function(){
            //删除图片后添加一个uploadimg
             var fileInput = jquery(this) 
            var parent= jquery(this).parents('.caruploadbox')
            var clone= jquery(this).parent('.caruploadimg').clone(true)
            clone.find('.carshowimg').attr("src",'').hide()
            clone.find('.carcloseimg').hide()
            parent.append(clone)
            jquery(this).parent('.caruploadimg').remove()
             that.setState({carimg:''})
        }) 

         //uploadbtn 上传公积金图片
         var that=this
        jquery('input#fundupinput').on('change', function () {
            var fileInput = jquery(this)
            util.fileUpload(fileInput[0].files[0], function (res) {
                var thisupload=fileInput.parents(".funduploadimg")
                thisupload.find(".fundshowimg").attr("src",res.data).show()
                thisupload.find(".fundcloseimg").show()
                that.setState({fundimg:res.data})
            })
            console.log(fileInput)
        })

         //删除公积金图片
           jquery(".fundcloseimg").on('click',function(){
            //删除图片后添加一个uploadimg
             var fileInput = jquery(this) 
            var parent= jquery(this).parents('.funduploadbox')
            var clone= jquery(this).parent('.funduploadimg').clone(true)
            clone.find('.fundshowimg').attr("src",'').hide()
            clone.find('.fundcloseimg').hide()
            parent.append(clone)
            jquery(this).parent('.funduploadimg').remove()
            that.setState({fundimg:''})
        }) 

        //uploadbtn 上传房产证图片
        var that=this
        jquery('input#houseupinput').on('change', function () {
            var fileInput = jquery(this)
            util.fileUpload(fileInput[0].files[0], function (res) {
                var thisupload=fileInput.parents(".houseuploadimg")
                thisupload.find(".houseshowimg").attr("src",res.data).show()
                thisupload.find(".housecloseimg").show()
                that.setState({houseimg:res.data})
            })
            console.log(fileInput)
        })

        //删除房产证图片
        jquery(".housecloseimg").on('click',function(){
            //删除图片后添加一个uploadimg
            var fileInput = jquery(this) 
            var parent= jquery(this).parents('.houseuploadbox')
            var clone= jquery(this).parent('.houseuploadimg').clone(true)
            clone.find('.houseshowimg').attr("src",'').hide()
            clone.find('.housecloseimg').hide()
            parent.append(clone)
            jquery(this).parent('.houseuploadimg').remove()
            that.setState({houseimg:''})
        }) 

        //删除身份证图片
        jquery(".idcloseimg").on('click',function(){
            //删除图片后判断 看另一个div中的showimg有没有值，有：添加一个uploadimg 没有值：不操作
            var siblings= jquery(this).parent('.iduploadimg').siblings('.iduploadimg')
            var parent= siblings.parents('.iduploadbox')
            var value= siblings.find(".idshowimg").attr("src")
            jquery(this).parent('.iduploadimg').remove()
            if(!value){//没有值
                return
            }else{
                var clone= siblings.clone(true)
                clone.find('.idshowimg').attr("src",'').hide()
                clone.find('.idcloseimg').hide()
                parent.append(clone)
            }   
        }) 

         //删除征信报告图片
         var that=this
        jquery(".crcloseimg").on('click',function(){
            //删除图片后判断 看另ji个div中的showimg有没有值，有：添加一个uploadimg 没有值：不操作
            var siblings= jquery(this).parent('.cruploadimg').siblings('.cruploadimg')
            var parent= siblings.parents('.cruploadbox')
            var arr=[]//用于存储另ji个div中的showimg的值，为判断做准备
            // var brr=[]//用于存储img的url
            var firstsibling
            siblings.each(function(){
                var value=jquery(this).find(".crshowimg").attr("src")
                arr.push(value)
                // if(!value){}else{
                //     brr.push(value)
                // }
               firstsibling= jquery(this)
            })
            // if(brr.length>0){
            //      that.setState({creditimg:brr.join(";")})
            // }else{
            //      that.setState({creditimg:''})
            // }
            var add//用于判断arr中有没有空值’‘
            for(var i in arr){
                arr[i]=='' ? add=false:add=true
            }
            jquery(this).parent('.cruploadimg').remove()
            if(!add){//有空值，不操作
                return
            }else{
                var clone= firstsibling.clone(true)
                clone.find('.crshowimg').attr("src",'').hide()
                clone.find('.crcloseimg').hide()
                parent.append(clone)
            }
        })
    }

    async cleanstate(){
            // this.setState({ merryType: 0 })
            this.setState({ name: '' })
            this.setState({ tellphone: '' })
            this.setState({ operatecopname: '' })
            this.setState({ socialinstime: '' })
            this.setState({ jobtime: '' })
            this.setState({ monthsalary: '' })
            this.setState({ loanintend: '' })
            this.setState({ payment: '' })
            this.setState({ loannum: '' })
            this.setState({ loantime: '' })
            this.setState({ carnum: '' })
            this.setState({ caryear: '' })
            this.setState({ yearfeelimit: '' })
            this.setState({ insurancelimit: '' })
            this.setState({ insurancenperson: '' })
            this.setState({ housefund: '' })
            this.setState({ fundarea: '' })
            this.setState({ houseaddress: '' })
            this.setState({ minhouseworth: '' })
            this.setState({ maxhouseworth: '' })
            this.setState({ housearea: '' })
            this.setState({ houseTypeother: '' })
            this.setState({ houseMortgageMoney: '' })
            this.setState({ houseMoney: '' })
    }

     async showdata(){//将存入storage的input name val 取出,用于回显
         alert('showdata:  '+this.state.loantypesel)
        // var data = localStorage.getItem("inputdata"+util.getQuery().loantype)
        var data = localStorage.getItem("inputdata"+this.state.loantypesel)
        this.setState({merryType:localStorage.getItem("merryType"+this.state.loantypesel)})
        this.setState({housenatureType:localStorage.getItem("housenatureType"+this.state.loantypesel)})
        this.setState({jobState:localStorage.getItem("jobState"+this.state.loantypesel)})
        this.setState({houseType:localStorage.getItem("houseType"+this.state.loantypesel)})
        this.setState({mortgageType:localStorage.getItem("mortgageType"+this.state.loantypesel)})
        alert("merryType:  "+this.state.merryType)
        jquery("#merryType .itemspan").eq(this.state.merryType).attr("selected", true)
        // jquery("#merryType").selected(this.state.merryType)
        alert(data)
        if(data==null){
            this.cleanstate()
            return
        }else{
            this.setState({mortgageType:localStorage.getItem("mortgageType"+this.state.loantypesel)})
             var data1 = JSON.parse(data)
        var that = this
        for (var o in data1) {
            for (var i in data1[o]) {
                jquery("input").each(function () {
                    var aa = jquery(this).attr("name")
                    if (i === aa && aa === 'name') {
                        that.setState({ name: data1[o][i] })
                    }
                    if (i === aa && aa === 'tellphone') {
                        that.setState({ tellphone: data1[o][i] })
                    }
                    if (i === aa && aa === 'operatecopname') {
                        that.setState({ operatecopname: data1[o][i] })
                    }
                    if (i === aa && aa === 'socialinstime') {
                        that.setState({ socialinstime: data1[o][i] })
                    }
                    if (i === aa && aa === 'jobtime') {
                        that.setState({ jobtime: data1[o][i] })
                    }
                    if (i === aa && aa === 'monthsalary') {
                        that.setState({ monthsalary: data1[o][i] })
                    } 
                    if (i === aa && aa === 'loanintend') {
                        that.setState({ loanintend: data1[o][i] })
                    } 
                     if (i === aa && aa === 'payment') {
                        that.setState({ payment: data1[o][i] })
                    } 
                     if (i === aa && aa === 'loannum') {
                        that.setState({ loannum: data1[o][i] })
                    } 
                     if (i === aa && aa === 'loantime') {
                        that.setState({ loantime: data1[o][i] })
                    }
                      // car
                    if (i === aa && aa === 'carnum') {
                        that.setState({ carnum: data1[o][i] })
                    }
                    if (i === aa && aa === 'caryear') {
                        that.setState({ caryear: data1[o][i] })
                    }
                    // insurance 保单信息
                    if (i === aa && aa === 'yearfeelimit') {
                        that.setState({ yearfeelimit: data1[o][i] })
                    }
                    if (i === aa && aa === 'insurancelimit') {
                        that.setState({ insurancelimit: data1[o][i] })
                    }
                    if (i === aa && aa === 'insurancenperson') {
                        that.setState({ insurancenperson: data1[o][i] })
                    }
                    //job
                    if (i === aa && aa === 'housefund') {
                        that.setState({ housefund: data1[o][i] })
                    }
                    if (i === aa && aa === 'fundarea') {
                        that.setState({ fundarea: data1[o][i] })
                    }
                    // house
                    if (i === aa && aa === 'houseaddress') {
                        that.setState({ houseaddress: data1[o][i] })
                    }
                    if (i === aa && aa === 'minhouseworth') {
                        that.setState({ minhouseworth: data1[o][i] })
                    }
                     if (i === aa && aa === 'maxhouseworth') {
                        that.setState({ maxhouseworth: data1[o][i] })
                    }
                    if (i === aa && aa === 'housearea') {
                        that.setState({ housearea: data1[o][i] })
                    }
                    if (i === aa && aa === 'houseTypeother') {
                        that.setState({ houseTypeother: data1[o][i] })
                    }
                    if (i === aa && aa === 'houseMortgageMoney') {
                        that.setState({ houseMortgageMoney: data1[o][i] })
                    }
                     if (i === aa && aa === 'houseMoney') {
                        that.setState({ houseMoney: data1[o][i] })
                    }
                })
            }
        }
        }

     }
    
    //根据贷款类型显示内容
    async showbytype(){
        //根据loantype值显隐贷款类型
        var arr=[1,0,2,3,4]
        var that=this
        var loantype=this.state.loantypesel
        console.log("loantype:  "+loantype)
        for(var i in arr){
            if(loantype==arr[i]){
                jquery(".loantype2").show()
                jquery(".btnbox").show()
                jquery(".loantype"+loantype).show()
                if(loantype==0){//房贷 需要调整样式和选项
                    that.setState({ jobStateGroups: [{ value: 0, label: '法人' }, { value: 1, label: '股东' }, { value: 2, label: '雇员' },{ value: 3, label: '无' }]})
                    jquery(".b").show()
                }
            }else{
                jquery(".loantype"+arr[i]).hide()
                jquery(".loantype2").show()
                jquery(".btnbox").show()
            }
        }
        this.showdata()
    }
    //获取贷款产品
    async getprotype(j) {
        console.log(this.state.loantypesel)
        this.setState({ professionalGroups: [] })
        let res = await util.rjax({
            url: '/other/list?productType=' + j,
            type: 'get',
        })
        if (res) {
            var data = res.data.rows
            for (let i in data) {
                var obj = {}
                obj = { value: data[i].id, label: data[i].title }
                this.state.professionalGroups.push(obj)
                this.setState({ professionalShow: true })
            }
            // this.setState({ professional: this.state.professionalGroups[0].value })
        }
    }

    async clean(){
        localStorage.removeItem("inputdata"+this.state.loantypesel)
        this.cleanstate()
        // localStorage.setItem("houseType"+this.state.loantypesel, 0)
        // localStorage.setItem("housenatureType"+this.state.loantypesel, 0)
        // localStorage.setItem("jobState"+this.state.loantypesel, 0)
        // localStorage.setItem("merryType"+this.state.loantypesel, 0)
        // localStorage.setItem("mortgageType"+this.state.loantypesel, 0)
        if(this.state.loantypesel==0){//房贷
            localStorage.setItem("nojobtime", 0)
            localStorage.setItem("nomonthsalary", 0)
            localStorage.setItem("nosocialinstime", 0)
        }
        //  window.location.reload()  
    }

    async beforeSubmit() {
        var that=this
        //身份证照片
        var arr=[]
        var validateid
        var siblings= jquery('.iduploadimg')
        siblings.each(function(){
            var value=jquery(this).find(".idshowimg").attr("src")
            if(!value){}else{
                arr.push(value)
            }
        })
        if(arr.length>0){
            validateid=arr.join(";")
        }else{
            validateid=''
        }
      
        //征信报告照片 
        var brr=[]
        var valicredit
        var crsiblings= jquery('.cruploadimg')
        crsiblings.each(function(){
            var value=jquery(this).find(".crshowimg").attr("src")
            if(!value){}else{
                brr.push(value)
            }
        })
        if(brr.length>0){
            valicredit=brr.join(";")
        }else{
            valicredit=''
        }

        if (this.state.loantypesel == 2) {//信用
            for (let item of this.loantype0) {
                if (!item.func(this.state[item.key])) {
                    return;
                }else{
                    if(that.state.loantypesel < 0){
                        layer.open({content: "请选择贷款类型",btn: "好的"})
                        return
                    }
                     if(that.state.professional < 0){
                        layer.open({content: "请选择贷款产品",btn: "好的"})
                        return
                    }
                     if(jquery('#date3').val()==''){
                        layer.open({content: "钉钉完善资料时间不能为空",btn: "好的"})
                        return
                    }
                    if(validateid==''){
                        layer.open({content: "身份证照片不能为空",btn: "好的"})
                        return
                    }
                     if(valicredit==''){
                        layer.open({content: "征信报告照片不能为空",btn: "好的"})
                        return
                    }
                }
            }
        }else if (this.state.loantypesel == 1) {//车贷
             for (let item of this.loantype1) {
                if (!item.func(this.state[item.key])) {
                    return;
                }else{
                    if(that.state.loantypesel < 0){
                        layer.open({content: "请选择贷款类型",btn: "好的"})
                        return
                    }
                     if(that.state.professional < 0){
                        layer.open({content: "请选择贷款产品",btn: "好的"})
                        return
                    }
                     if(jquery('#date3').val()==''){
                        layer.open({content: "钉钉完善资料时间不能为空",btn: "好的"})
                        return
                    }
                   if(validateid==''){
                        layer.open({content: "身份证照片不能为空",btn: "好的"})
                        return
                    }
                    if(valicredit==''){
                        layer.open({content: "征信报告照片不能为空",btn: "好的"})
                        return
                    }
                    if(that.state.carimg==''){
                        layer.open({content: "行驶证照片不能为空",btn: "好的"})
                        return
                    }
                }
            }
        }else if (this.state.loantypesel == 4) {//公积金
             for (let item of this.loantype2) {
                if (!item.func(this.state[item.key])) {
                    return;
                }else{
                    if(that.state.loantypesel < 0){
                        layer.open({content: "请选择贷款类型",btn: "好的"})
                        return
                    }
                     if(that.state.professional < 0){
                        layer.open({content: "请选择贷款产品",btn: "好的"})
                        return
                    }
                     if(jquery('#date3').val()==''){
                        layer.open({content: "钉钉完善资料时间不能为空",btn: "好的"})
                        return
                    }
                    if(validateid==''){
                        layer.open({content: "身份证照片不能为空",btn: "好的"})
                        return
                    }
                    if(valicredit==''){
                        layer.open({content: "征信报告照片不能为空",btn: "好的"})
                        return
                    }
                    if(that.state.fundimg==''){
                        layer.open({content: "公积金照片不能为空",btn: "好的"})
                        return
                    }
                }
            }
        }else if (this.state.loantypesel == 0) {//房贷
             for (let item of this.loantype3) {
                if (!item.func(this.state[item.key])) {
                    return;
                }else{
                    if(that.state.loantypesel < 0){
                        layer.open({content: "请选择贷款类型",btn: "好的"})
                        return
                    }
                     if(that.state.professional < 0){
                        layer.open({content: "请选择贷款产品",btn: "好的"})
                        return
                    }
                     if(jquery('#date3').val()==''){
                        layer.open({content: "钉钉完善资料时间不能为空",btn: "好的"})
                        return
                    }
                    var arr=["socialinstime","jobtime","monthsalary"]
                    for(var i in arr){
                         var a= localStorage.getItem("no"+arr[i])
                        if(!a || a === 'null'|| a == 0){
                            if(jquery("#"+arr[i]).val()===""){
                               var tit= jquery("#"+arr[i]).attr("title")
                                layer.open({content: tit+"不能为空",btn: "好的"})
                                return;
                            }
                        }
                        
                    }
                    if(that.state.jobState==0||that.state.jobState==1||that.state.jobState==2){
                        if(jquery("#operatecopname").val()===""){
                            layer.open({content: "请输入工作单位名称",btn: "好的"})
                            return;
                        }
                    }
                    if(that.state.houseType==4){
                        if(jquery("#houseTypeother").val()===""){
                            layer.open({content: "其他房产类型不能为空",btn: "好的"})
                            return;
                        }
                    }
                    if(validateid==''){
                        layer.open({content: "身份证照片不能为空",btn: "好的"})
                        return
                    }
                    if(valicredit==''){
                        layer.open({content: "征信报告照片不能为空",btn: "好的"})
                        return
                    }
                    // 房产价值最大值与最小值之间不能大于20万
                    var minhouseworth=jquery("input[name=minhouseworth]").val()
                    var maxhouseworth=jquery("input[name=maxhouseworth]").val()
                    if((maxhouseworth-minhouseworth)>20){
                        layer.open({content: "房产价值最大值与最小值之间不能大于20万",btn: "好的"})
                        return;
                    }
                    if(that.state.mortgageType==0){
                        if(jquery("#houseMortgageMoney").val()===""){
                            layer.open({content: "请输入需求金额",btn: "好的"})
                            return;
                        }
                    }
                    if(that.state.mortgageType==1){
                        if(jquery("#houseMoney").val()===""){
                            layer.open({content: "请输入一押余额",btn: "好的"})
                            return;
                        }
                    }
                     if(that.state.houseimg==''){
                        layer.open({content: "房产证照片不能为空",btn: "好的"})
                        return
                    }
                }
            }
        }else if (this.state.loantypesel == 4) {//保单贷
             for (let item of this.loantype4) {
                if (!item.func(this.state[item.key])) {
                    return;
                }else{
                    if(that.state.loantypesel < 0){
                        layer.open({content: "请选择贷款类型",btn: "好的"})
                        return
                    }
                     if(that.state.professional < 0){
                        layer.open({content: "请选择贷款产品",btn: "好的"})
                        return
                    }
                     if(jquery('#date3').val()==''){
                        layer.open({content: "钉钉完善资料时间不能为空",btn: "好的"})
                        return
                    }
                    if(validateid==''){
                        layer.open({content: "身份证照片不能为空",btn: "好的"})
                        return
                    }
                    if(valicredit==''){
                        layer.open({content: "征信报告照片不能为空",btn: "好的"})
                        return
                    }
                }
            }
        }

        let body = {
            productId: this.state.professional,
            salePhone: localStorage.getItem("salephone"),
            applySource: 1,
            submitTime:jquery('#date3').val(),
            // ddtime:this.state.ddtime,
            // professional  个人信息--14
            name: this.state.name,//1
            phone: this.state.tellphone,//2
            marry: this.state.merryType,//3
            company: this.state.operatecopname,//工作单位名称4
            work: this.state.jobState,//法人股东雇员5
            sbMonth: this.state.socialinstime,//社保缴存期限6
            workMonth:this.state.jobtime,//当前单位工作期限7
            salary: this.state.monthsalary,//打卡工资8
            loanUse:this.state.loanintend,//贷款用途9
            paySource:this.state.payment,//还款来源10
            loanTotal: this.state.loannum,//借款金额11
            loanMonth: this.state.loantime,//借款期限12
            idCard:validateid,//身份证图片13
            credit:valicredit,//征信报告图片14
              // car  --3
            carNumber: this.state.carnum,//车牌号  1
            carYear: this.state.caryear,//上牌年限  2
            carCard:this.state.carimg,//行驶证图片  3
            // insurance  --3
            guaranteeMonth: this.state.insurancelimit,//汇缴期限  1
            guaranteeUser: this.state.insurancenperson,//投保人姓名  2
            guaranteeMoney: this.state.yearfeelimit,//年度汇缴额（元）  3
            //job  --3
            gjjMoney: this.state.housefund,//双边汇款额  1
            gjjAddress: this.state.fundarea,//缴存地  2
            gjjImage:this.state.fundimg,//公积金图片  3
            // house  --10
            houseAddress: this.state.houseaddress,//房产地址  1
            housePay: this.state.housenatureType,//按揭／全款  2
            houseMin: this.state.minhouseworth,//房产价值  3
            houseMax:  this.state.maxhouseworth,//  4
            houseArea: this.state.housearea,//面积  5
            houseType: this.state.houseType,//房产类型  6
            houseMortgage: this.state.mortgageType,//抵押类型  7
            houseMortgageMoney: this.state.houseMortgageMoney,//选择一押时请输入  8
            houseMoney: this.state.houseMoney,//选择一押时请输入  9
            houseOtherType: this.state.houseTypeother,//其他房产类型  10
            houseCard:this.state.houseimg,//房产证图片  11
        }
        let res = await util.rjax({
            url: '/otherProductApply/insertUser',
            type: "POST",
            data: body
        }).catch((e) => {
            layer.open({
                content: '请按规定填写数据',
                btn: "好的"
            })
        })
        if (res) {
            var that=this;
            layer.open({content: '操作成功',btn: "好的",yes: function () {
                    //清空数据
                    that.clean()
                }
            })
        }
    }
    // professinfo  个人信息
    nameChange(e) {
        this.setState({ name: e.target.value })
    }
    tellphoneChange(e) {
        this.setState({ tellphone: e.target.value })
    }
    operatecopnameChange(e) {
        this.setState({ operatecopname: e.target.value })
    }
    socialinstimeChange(e) {
        this.setState({ socialinstime: e.target.value })
    }
    jobtimeChange(e){
         this.setState({ jobtime: e.target.value })
    }
    monthsalaryChange(e) {
        this.setState({ monthsalary: e.target.value })
    }
    loanintendChange(e) {
        this.setState({ loanintend: e.target.value })
    }
    paymentChange(e) {
        this.setState({ payment: e.target.value })
    }
   loannumChange(e){
         this.setState({ loannum: e.target.value })
    }
   loantimeChange(e) {
        this.setState({ loantime: e.target.value })
    }
      // car          
    carnumChange(e) {
        this.setState({ carnum: e.target.value })
    }
    caryearChange(e) {
        this.setState({ caryear: e.target.value })
    }
    // insurance       
    insurancelimitChange(e) {
        this.setState({ insurancelimit: e.target.value })
    }
    insurancenpersonChange(e) {
        this.setState({ insurancenperson: e.target.value })
    }
    yearfeelimitChange(e) {
        this.setState({ yearfeelimit: e.target.value })
    }
    //job
    housefundChange(e) {
        this.setState({ housefund: e.target.value })
    }
    fundareaChange(e) {
        this.setState({ fundarea: e.target.value })
    }
    // house    
    houseaddressChange(e) {
        this.setState({ houseaddress: e.target.value })
    }
    minhouseworthChange(e) {
        this.setState({ minhouseworth: e.target.value })
    }
    maxhouseworthChange(e) {
        this.setState({ maxhouseworth: e.target.value })
    }
    houseareaChange(e) {
        this.setState({ housearea: e.target.value })
    }
    houseMortgageMoneyChange(e) {
        this.setState({ houseMortgageMoney: e.target.value })
    }
     houseMoneyChange(e) {
        this.setState({ houseMoney: e.target.value })
    }
    houseTypeotherChange(e) {
        this.setState({ houseTypeother: e.target.value })
    }

    render() {
        return (

            <div className="declaration">
               <div className="previewbox">
                    <img className="previewimg" src=""/>
               </div>
                <div className="card pro">
                    <Sel1View  title={this.state.loantypetit} label={this.state.loantypeselLabel} onClick={() => {  this.setState({ loantypeselShow: true }) }} />
                    <Sel1View className="typesel" title={this.state.protit} label={this.state.professionalLabel} onClick={() => { this.getprotype(this.state.loantypesel) }} />
                    <div className="inputbox">
                        <div>
                            <span>钉钉完善资料时间</span>
                            <input  placeholder="请选择" name="ddtime" type="text" id="date3" data-options="{'type':'YYYY-MM-DD hh:mm:ss','beginYear':2010,'endYear':2088}" style={{width:'140px',height:'19px'}}/>
                        </div>
                    </div>
                </div>
                
                <Picker show={this.state.loantypeselShow} groups={this.state.loantypeselGroups} onChange={(val, label) => { this.setState({ loantypesel: val, loantypeselLabel: label, loantypeselShow: false }),this.showbytype() }} onMaskClick={() => { this.setState({ loantypeselShow: false }) }} />
                <Picker show={this.state.professionalShow} groups={this.state.professionalGroups} onChange={(val, label) => { this.setState({ professional: val, professionalLabel: label, professionalShow: false }) }} onMaskClick={() => { this.setState({ professionalShow: false }) }} />

                <div className="card loantype2" style={{display:'none'}}>
                    <h4>客户基本信息</h4>
                    <div className="inputbox">
                        <div>
                            <span>姓名</span>
                            <input placeholder="文字填写" name="name" value={this.state.name} onChange={this.nameChange.bind(this)} type="text" />
                        </div>
                        <div>
                            <span>手机号</span>
                            <input placeholder="数字填写" name="tellphone" maxLength="11" value={this.state.tellphone} onChange={this.tellphoneChange.bind(this)} type="number" />
                        </div>
                        <RadioPicker1 id="merryType" selected={this.state.merryType} title="婚姻状况" name={"merryType"+(this.state.loantypesel)} groups={this.state.merryTypeGroups} onChange={(val) => { this.setState({ merryType: val });this.state.loantypesel=='-1' ? localStorage.setItem("merryType0", val):localStorage.setItem("merryType"+this.state.loantypesel, val) }} />
                        <div>
                            <span>工作单位名称</span>
                            <input placeholder="文字填写" id="operatecopname" name="operatecopname" value={this.state.operatecopname} onChange={this.operatecopnameChange.bind(this)} type="text" />
                        </div>
                         <RadioPicker1 title="" groups={this.state.jobStateGroups} name={"jobState"+this.state.loantypesel} onChange={(val) => { this.setState({ jobState: val }); localStorage.setItem("jobState"+this.state.loantypesel, val) }} />
                        <div>
                            <span>社保缴存期限(月)</span>
                            <b className="b" id="nosocialinstime"><i className="i"></i>无</b>
                            <input placeholder="数字填写" id="socialinstime" name="socialinstime" title="社保缴存期限(月)" value={this.state.socialinstime} onChange={this.socialinstimeChange.bind(this)} type="number" />
                        </div>
                         <div>
                            <span>当前单位工作期限(月)</span>
                             <b className="b" id="nojobtime"><i className="i"></i>无</b>
                            <input placeholder="数字填写" id="jobtime" name="jobtime"  title="当前单位工作期限(月)"  value={this.state.jobtime} onChange={this.jobtimeChange.bind(this)} type="number" />
                        </div>
                         <div>
                            <span>打卡工资(月度)</span>
                             <b className="b" id="nomonthsalary"><i className="i"></i>无</b>
                            <input placeholder="数字填写" id="monthsalary" name="monthsalary" title="打卡工资(月度)" value={this.state.monthsalary} onChange={this.monthsalaryChange.bind(this)} type="number" />
                        </div>
                         <div>
                            <span>贷款用途</span>
                            <input placeholder="文字填写" name="loanintend" value={this.state.loanintend} onChange={this.loanintendChange.bind(this)} type="text" />
                        </div>
                        <div>
                            <span>还款来源</span>
                            <input placeholder="文字填写" name="payment" value={this.state.payment} onChange={this.paymentChange.bind(this)} type="text" />
                        </div>
                        <div>
                            <span>借款金额(万元)</span>
                            <input placeholder="数字填写" name="loannum" value={this.state.loannum} onChange={this.loannumChange.bind(this)} type="number" />
                        </div>
                        <div>
                            <span>借款期限(月)</span>
                           <input placeholder="数字填写" name="loantime" value={this.state.loantime} onChange={this.loantimeChange.bind(this)} type="number" />
                        </div>
                         <div className="iduploadbox">
                            <p>身份证(正反面上传)</p>
                            <div className="iduploadimg">
                                <label>
                                    <input className="identity"  id="identity" type="file" />
                                    <img className="idimgadd" src="/assets/wechat/imgadd.png"/>
                                </label>
                                <img style={{display:'none'}}  className='idcloseimg' src='/assets/wechat/delete.png'/>
                                <img className="idshowimg" src="" style={{display:'none'}} alt=""/>
                            </div>
                        </div> 
                        <div className="cruploadbox">
                            <p>征信报告(不超过5项)</p>
                            <p className="desc">必须上传第一、二页及查询月；自选上传:逾期月</p>
                            <div className="cruploadimg">
                                <label>
                                    <input className="credit"  id="credit" type="file" />
                                    <img className="crimgadd" src="/assets/wechat/imgadd.png"/>
                                </label>
                                <img  className='crcloseimg' style={{display:'none'}}  src='/assets/wechat/delete.png'/>
                                <img className="crshowimg" style={{display:'none'}} alt=""/>
                            </div>
                        </div>
                    </div>
                </div>

                 <div className="card loantype1" style={{display:'none'}}>
                    <h4>车产信息</h4>
                    <div className="inputbox">
                        <div>
                            <span>车牌号</span>
                            <input placeholder="填写" name="carnum" value={this.state.carnum} onChange={this.carnumChange.bind(this)} type="text" />
                        </div>
                        <div>
                            <span>上牌年限(月)</span>
                            <input placeholder="数字填写" name="caryear" value={this.state.caryear} onChange={this.caryearChange.bind(this)} type="number" />
                        </div>
                         <div className='caruploadbox'>
                            <p>行驶证</p>
                            <div className='caruploadimg'>
                                <label>
                                    <input className="carupinput" value='' id="carupinput" name="" type="file" />
                                    <img className="carimgadd" src="/assets/wechat/imgadd.png"/>
                                </label>
                                <img  className='carcloseimg' style={{display:'none'}}  src='/assets/wechat/delete.png'/>
                                <img className="carshowimg" style={{display:'none'}} alt=""/>
                            </div>
                        </div>
                    </div>
                </div>

                 <div className="card loantype4" style={{display:'none'}}>
                    <h4>公积金信息</h4>
                    <div className="inputbox">
                        <div>
                            <span>缴存地</span>
                            <input placeholder="请注意区分省、市公积金填写" name="fundarea" value={this.state.fundarea} onChange={this.fundareaChange.bind(this)} type="text" />
                        </div>
                        <div>
                            <span>双边汇款额(元)</span>
                            <input placeholder="数字填写" name="housefund" value={this.state.housefund} onChange={this.housefundChange.bind(this)} type="number" />
                        </div>
                        <div className='funduploadbox'>
                            <p>选择上传图片（可选填）</p>
                             <p className="funddesc">可上传我的南京</p>
                            <div className='funduploadimg'>
                                <label>
                                    <input className="fundupinput" value='' id="fundupinput" name="" type="file" />
                                    <img className="fundimgadd" src="/assets/wechat/imgadd.png"/>
                                </label>
                                <img  className='fundcloseimg' style={{display:'none'}}  src='/assets/wechat/delete.png'/>
                                <img className="fundshowimg" style={{display:'none'}} alt=""/>
                            </div>
                        </div>
                    </div>
                </div>

                <div className="card house loantype0" style={{display:'none'}}>
                    <h4>房产信息</h4>
                    <div className="inputbox">
                        <div>
                            <span>房产地址</span>
                            <input placeholder="文字填写" name="houseaddress" value={this.state.houseaddress} onChange={this.houseaddressChange.bind(this)} type="text" />
                        </div>
                        <RadioPicker1 title="按揭／全款" groups={this.state.housenatureTypeGroups} name={"housenatureType"+this.state.loantypesel} onChange={(val) => { this.setState({ housenatureType: val }); localStorage.setItem("housenatureType"+this.state.loantypesel, val) }} />
                        <div style={{margin: '16px 0px 8px 0px'}}>
                            <span>房产价值(万元)</span>
                            <input placeholder="输入最小值" name="minhouseworth" value={this.state.minhouseworth} onChange={this.minhouseworthChange.bind(this)} type="number" />
                        </div>
                          <div style={{margin: '8px 0px 16px 0px'}}>
                            <span>&nbsp;</span>
                            <input placeholder="输入最大值" name="maxhouseworth" value={this.state.maxhouseworth} onChange={this.maxhouseworthChange.bind(this)} type="number" />
                        </div>
                        <div>
                            <span>面积(平方米)</span>
                            <input placeholder="数字填写" name="housearea" value={this.state.housearea} onChange={this.houseareaChange.bind(this)} type="number" />
                        </div>
                        <RadioPicker1 title="房产类型" groups={this.state.houseTypeGroups} name={"houseType"+this.state.loantypesel} onChange={(val) => { this.setState({ houseType: val }); localStorage.setItem("houseType"+this.state.loantypesel, val) }} />
                        <div className="houseTypebox">
                            <input className="houseTypeother" title="其他房产类型" id="houseTypeother" name="houseTypeother" placeholder="请输入其他房产类" type="text" value={this.state.houseTypeother} onChange={this.houseTypeotherChange.bind(this)} />
                        </div>
                        <RadioPicker1 class="mortgage" title="抵押类型" groups={this.state.mortgageTypeGroups} name={"mortgageType"+this.state.loantypesel} onChange={(val) => { this.setState({ mortgageType: val }); localStorage.setItem("mortgageType"+this.state.loantypesel, val) }} />
                        <div className="MortgageMoneybox1">
                            <input className="houseMortgageMoney" placeholder="输入需求金额" type="number" id="houseMortgageMoney" name="houseMortgageMoney" value={this.state.houseMortgageMoney} onChange={this.houseMortgageMoneyChange.bind(this)} />&nbsp;万元
                       </div>
                       <div className="MortgageMoneybox2">
                            <input className="houseMoney" placeholder="输入一押余额" type="number" id="houseMoney" name="houseMoney" value={this.state.houseMoney} onChange={this.houseMoneyChange.bind(this)} />&nbsp;万元
                       </div>
                        <div className='houseuploadbox'>
                            <p>房产证上传(产权所有人单页)</p>
                            <div className='houseuploadimg'>
                                <label>
                                    <input className="houseupinput" value='' id="houseupinput" name="" type="file" />
                                    <img className="houseimgadd" src="/assets/wechat/imgadd.png"/>
                                </label>
                                <img  className='housecloseimg' style={{display:'none'}}  src='/assets/wechat/delete.png'/>
                                <img className="houseshowimg" style={{display:'none'}} alt=""/>
                            </div>
                        </div>
                    </div>
                </div>

                <div className="card loantype3" style={{display:'none'}}>
                    <h4>保单信息</h4>
                    <div className="inputbox">
                        <div>
                            <span>投保人姓名</span>
                            <input placeholder="文字填写" name="insurancenperson" value={this.state.insurancenperson} onChange={this.insurancenpersonChange.bind(this)} type="text" />
                        </div>
                        <div>
                            <span>年度汇缴额(元)</span>
                            <input placeholder="数字填写" name="yearfeelimit" value={this.state.yearfeelimit} onChange={this.yearfeelimitChange.bind(this)} type="number" />
                        </div>
                        <div>
                            <span>汇缴期限(月)</span>
                            <input placeholder="数字填写" name="insurancelimit" value={this.state.insurancelimit} onChange={this.insurancelimitChange.bind(this)} type="number" />
                        </div>
                    </div>
                </div>
                <div className="btnbox" style={{display:'none'}}>
                    <input className="loanbtn" onClick={this.beforeSubmit.bind(this)} type="button" value="确定" />
                    <input className="cleanbtn" onClick={this.clean.bind(this)} type="button" value="一键清空" />
                </div>
               

            </div>
        )
    }
}

ReactDom.render(<Declarv2 />, document.getElementById('app'))